<template>
  <div class="content-box">
    <table class="table-box">
      <thead>
        <tr>
          <th>套餐名称</th>
          <th>购买时间</th>
          <th>套餐价格</th>
          <th>支付状态</th>
          <th>使用状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in tabList" :key="index">
          <td>{{item.packageName}}</td>
          <td>{{item.gmtCreate | changeTime}}</td>
          <td>￥{{item.packagePrice}}</td>
          <td>{{PAYSTATUS[item.payStatus] }}</td>
          <td :style="{'color':item.finishied==1?'#67C23A':'#aaa'}">{{item.payStatus==1?(item.finishied==1?'已使用':'未使用完'):''}}</td>
          <td>
            <el-link @click="onDetail(item)">查看</el-link>
          </td>
        </tr>
      </tbody>
    </table>
    <div v-if="tabList.length == 0" style="color:#999;padding:10px 0;text-align:center;">
      <i class="iconfont iconwushuju" style="font-size:40px;"></i>
      <div>暂无数据</div>
    </div>
    <br />
    <detail v-model="showCombo" :curItem="curItem"></detail>
    <pager v-model="pager" @change-pagenum="getAllCombo"></pager>
  </div>
</template>
<script>
import enumArr from '../_enum/enum'
export default {
  data() {
    return {
      tabList: [],
      pager: { pageSize: 20, pageNum: 1, total: 0 },
      form: { patientId: "", hpId: "" },
      curItem: "",
      showCombo:false,
      PAYSTATUS:enumArr.PAYSTATUS,
    };
  },
  mounted() {
      const th=this;
      th.getAllCombo();
  },
  methods: {
    getAllCombo() {
      const th = this;
      let json = {patientId:th.jieMi(th.$route.query.id),payStatus:'0,1,2'};
      Object.assign(json, th.pager);
      th.$api.tc_findUserPackageProjectAll(json).then(res => {
        if (res.executed) {
            th.tabList=res.dataBody.list;
            th.pager.total=res.dataBody.total;
        }
      });
    },
    onDetail(obj){
        const th=this;
        th.curItem=obj;
        th.showCombo=true;
    }
  },
  components:{
      "detail":()=>import("../_com/comboDetail")
  }
};
</script>